<template>
  <div class="ff-regular">
    <Modal v-model="cancelPop" width="60" @on-visible-change="closeBtn" class-name="vertical-center-modal"
      :mask-closable="false">
      <!-- 页头 -->
      <div slot="header" class="header-title ff-bold">{{ cancelItem.title }}</div>
      <!-- 内容 -->
      <div class="content-wrap">
        <div class="title">{{ cancelItem.text }}</div>
        <div class="pop-content">
          <Input v-model="cancelRmk" maxlength="200" :rows="8" show-word-limit type="textarea"
            :placeholder="cancelItem.placeholder" />
        </div>
      </div>
      <!-- 底部 -->
      <div slot="footer" class="footer-wrap">
        <div class="cancel-btn" @click="onHidePop">{{ cancelItem.cancel }}</div>
        <div class="confirm-btn" @click="onCancelOrder">{{ cancelItem.confirm }}</div>
      </div>
    </Modal>
  </div>
</template>
<script>

export default {
  props: ['cancelItem'],
  data() {
    return {
      cancelPop: false,
      cancelRmk: ''
    }
  },
  methods: {
    onHidePop() {
      this.cancelPop = false;
      this.cancelRmk = '';
    },
    onCancelOrder() {
      this.$emit('confirmCancel', this.cancelRmk)
    },
    closeBtn(val) {
      if (val == false) {
        this.cancelRmk = '';
      }
    }
  }
}
</script>

<style lang="less" scoped>
:deep(.ivu-modal-header) {
  border: none;
  padding: 48px 46px;
}

:deep(.ivu-modal-body) {
  padding: 0 46px;
}

:deep(.ivu-modal-footer) {
  border: none;
  padding: 48px 46px;
}

:deep(.ivu-modal-close) {
  position: absolute;
  top: 42px;
  right: 43px;
}

:deep(.ivu-modal-close .ivu-icon-ios-close) {
  color: #333333;
  font-size: 32px;
}

.vertical-center-modal {
  display: flex;
  align-items: center;
  justify-content: center;

  .header-title {
    font-weight: 600;
    font-size: 20px;
    color: #333333;
    line-height: 23px;
  }

  .content-wrap {

    .title {
      font-weight: 400;
      font-size: 20px;
      color: #333333;
      line-height: 23px;
    }

    .pop-content {
      margin-top: 32px;

      :deep(textarea.ivu-input) {
        padding: 20px;
        background: #F5F6FA;
        border-radius: 8px 8px 8px 8px;
        font-weight: 400;
        font-size: 18px;
        line-height: 21px;
      }
    }
  }

  .footer-wrap {
    display: flex;
    justify-content: end;
    gap: 20px;

    .cancel-btn {
      padding: 12px 20px;
      border-radius: 8px 8px 8px 8px;
      border: 1px solid #FF186B;
      font-weight: 400;
      font-size: 18px;
      color: #FF186B;
      line-height: 21px;
      cursor: pointer;
    }

    .confirm-btn {
      padding: 12px 20px;
      border-radius: 8px 8px 8px 8px;
      border: 1px solid #FF186B;
      background: #FF186B;
      font-weight: 400;
      font-size: 18px;
      color: #FFFFFF;
      line-height: 21px;
      cursor: pointer;
    }
  }
}
</style>
